package com.wavehi.service;

import com.wavehi.pojo.User;

import java.util.List;

/**
 * @Author WaveHi
 * @Date 26/9/2021 下午 3:57
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Business layer for user.
 */
public interface IUserService {

    /**
     * Add user。
     * @param user an object that encapsulates the user information
     * @return return false indicate that add failed.
     */
    Boolean addUser(User user);

    /**
     * Delete user according to id.
     * @param id the id corresponding to user
     * @return return false indicate that delete failed.
     */
    Boolean deleteUser(Long id);

    /**
     * Update user.
     * @param user an object that encapsulates the user information.
     * @return return false indicate that update failed.
     */
    Boolean updateUser(User user);

    /**
     * judge whether the user exists according to user name.
     * @param username user name
     * @return return false indicate that use do not exist.
     */
    Boolean userExists(String username);

    /**
     * Judge whether the user exists according to user name and password.
     * @param username user name
     * @param password password
     * @return return false indicate that the user do not exist.
     */
    Boolean userExists(String username, String password);

    /**
     * Get the user information according to id corresponding to user.
     * @param id the id corresponding to user.
     * @return return an object that encapsulates the specified user information.
     */
    User getUser(Long id);

    /**
     * Get the user information according to user name.
     * @param username user name
     * @return return an object that encapsulates the specified user information.
     */
    User getUser(String username);

    /**
     * Get all the user information.
     * @return return a list that contains all the user information.
     */
    List<User> getAllUsers();
}
